﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="slowniki.aspx.cs" Inherits="KsiazkaKucharska.slowniki" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td width="50%" class="nazwa">Produkty</td><td width="50%" class="nazwa">Jednostki</td></tr>

<tr>
<td width="50%" valign="top">

    <asp:GridView ID="ProduktyGridView" runat="server" AllowPaging="True" HeaderStyle-CssClass="gridViewHeader"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_produktu" HeaderStyle-BackColor="#99CCFF" 
        DataSourceID="ProduktySqlDataSource" Width="90%" PageSize="20">
        <Columns>
            <asp:TemplateField HeaderText="Id Produktu" InsertVisible="False" 
                SortExpression="id_produktu">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_produktu") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id_produktu") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nazwa Produktu" SortExpression="nazwa_produktu">
                <EditItemTemplate>
                    <asp:TextBox ID="NazwaProduktuTextBox" runat="server" Text='<%# Bind("nazwa_produktu") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("nazwa_produktu") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:CommandField CancelText="Anuluj" DeleteText="Usuń" EditText="Edytuj" 
                InsertText="Wstaw" NewText="Nowy" ShowEditButton="True" UpdateText="Zmień" ShowDeleteButton="True" DeleteImageUrl="img/delete.png" EditImageUrl="img/edit.png" ButtonType="Image" CancelImageUrl="img/cancel.png" UpdateImageUrl="img/ok.png" />
        </Columns>
    </asp:GridView>
</td>
<td width="50%" valign="top">

    <asp:GridView ID="JednostkiGridView" runat="server" AllowPaging="True" HeaderStyle-CssClass="gridViewHeader"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_jednostki" HeaderStyle-BackColor="#99CCFF" 
        DataSourceID="JednostkiSqlDataSource" Width="90%" PageSize="20">
        <Columns>
            <asp:TemplateField HeaderText="Id Jednostki" InsertVisible="False" 
                SortExpression="id_jednostki">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_jednostki") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id_jednostki") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nazwa Jednostki" SortExpression="nazwa_jednostki">
                <EditItemTemplate>
                    <asp:TextBox ID="NazwaJednostkiTextBox" runat="server" Text='<%# Bind("nazwa_jednostki") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("nazwa_jednostki") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:CommandField CancelText="Anuluj" DeleteText="Usuń" EditText="Edytuj" 
                InsertText="Wstaw" NewText="Nowy" ShowEditButton="True" UpdateText="Zmień" ShowDeleteButton="True" DeleteImageUrl="img/delete.png" EditImageUrl="img/edit.png" ButtonType="Image" CancelImageUrl="img/cancel.png" UpdateImageUrl="img/ok.png" />
        </Columns>
    </asp:GridView>
</td>
</tr>
<tr>
<td width="50%" align="center">

     <asp:PlaceHolder ID="NowyProduktPlaceHolder" runat="server" >
                    <asp:TextBox ID="NewNazwaProduktuTextBox" runat="server" Text="" Width="80%"></asp:TextBox>
                    <br />
    <center><asp:Button ID="NewNazwaProduktuButton" runat="server" Text="Dodaj produkt" OnClick="NewNazwaProduktuButton_Click" /></center>
    </asp:PlaceHolder>
</td>
<td width="50%" align="center">
     <asp:PlaceHolder ID="NewJednostkaPlaceHolder" runat="server" >
                    <asp:TextBox ID="NewNazwaJednostkiTextBox" runat="server" Text="" Width="80%"></asp:TextBox>
                    <br />
    <center><asp:Button ID="NewNazwaJednostkiButton" runat="server" Text="Dodaj jednostkę" OnClick="NewNazwaJednostkiButton_Click" /></center>
    </asp:PlaceHolder>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;<br /><br /><br /><br />
</td>
</tr>
<tr><td class="nazwa">Kategorie</td><td class="nazwa">Poziomy Trudności</td></tr>
<tr>
<td width="50%" valign="top">


    <asp:GridView ID="KategorieGridView" runat="server" AllowPaging="True" HeaderStyle-CssClass="gridViewHeader"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_kategorii" HeaderStyle-BackColor="#99CCFF" 
        DataSourceID="KategorieSqlDataSource" Width="90%" PageSize="20">
        <Columns>
            <asp:TemplateField HeaderText="Id Kategorii" InsertVisible="False" 
                SortExpression="id_kategorii">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_kategorii") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id_kategorii") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nazwa Kategorii" SortExpression="nazwa_kategorii">
                <EditItemTemplate>
                    <asp:TextBox ID="NazwaKategoriiTextBox" runat="server" Text='<%# Bind("nazwa_kategorii") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("nazwa_kategorii") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:CommandField CancelText="Anuluj" DeleteText="Usuń" EditText="Edytuj" 
                InsertText="Wstaw" NewText="Nowy" ShowEditButton="True" UpdateText="Zmień" ShowDeleteButton="True" DeleteImageUrl="img/delete.png" EditImageUrl="img/edit.png" ButtonType="Image" CancelImageUrl="img/cancel.png" UpdateImageUrl="img/ok.png" />
        </Columns>
    </asp:GridView>
</td>
<td width="50%" valign="top">

    
    <asp:GridView ID="PoziomyTrudnosciGridView" runat="server" AllowPaging="True" HeaderStyle-CssClass="gridViewHeader"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_poziomu_trudnosci" HeaderStyle-BackColor="#99CCFF" 
        DataSourceID="PoziomyTrudnosciSqlDataSource" Width="90%" PageSize="20">
        <Columns>
            <asp:TemplateField HeaderText="Id Poziomu Trudnosci" InsertVisible="False" 
                SortExpression="id_poziomu_trudnosci">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id_poziomu_trudnosci") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id_poziomu_trudnosci") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Poziom Trudnosci" SortExpression="poziom_trudnosci">
                <EditItemTemplate>
                    <asp:TextBox ID="PoziomTrudnosciTextBox" runat="server" Text='<%# Bind("poziom_trudnosci") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("poziom_trudnosci") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle CssClass="lista" />
            </asp:TemplateField>
            <asp:CommandField CancelText="Anuluj" DeleteText="Usuń" EditText="Edytuj" 
                InsertText="Wstaw" NewText="Nowy" ShowEditButton="True" UpdateText="Zmień" ShowDeleteButton="True" DeleteImageUrl="img/delete.png" EditImageUrl="img/edit.png" ButtonType="Image" CancelImageUrl="img/cancel.png" UpdateImageUrl="img/ok.png" />
        </Columns>
    </asp:GridView>
</td>
</tr>
<tr>
<td width="50%" align="center">
     <asp:PlaceHolder ID="NewKategoriaPlaceHolder" runat="server" >
                    <asp:TextBox ID="NewNazwaKategoriiTextBox" runat="server" Text="" Width="80%"></asp:TextBox>
                    <br />
    <center><asp:Button ID="NewNazwaKategoriiButton" runat="server" Text="Dodaj kategorię" OnClick="NewNazwaKategoriiButton_Click" /></center>
    </asp:PlaceHolder>
</td>
<td width="50%" align="center">

     <asp:PlaceHolder ID="NewPoziomTrudnosciPlaceHolder" runat="server" >
                    <asp:TextBox ID="NewNazwaPoziomuTrudnosciTextBox" runat="server" Text="" Width="80%"></asp:TextBox>
                    <br />
    <center><asp:Button ID="NewNazwaPoziomuTrudnosciButton" runat="server" Text="Dodaj poziom trudności" OnClick="NewNazwaPoziomuTrudnosciButton_Click" /></center>
    </asp:PlaceHolder>
</td>
</tr>
</table>

    <asp:SqlDataSource ID="ProduktySqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ksiazka_kucharskaConnectionString %>" 
        DeleteCommand="DELETE FROM [produkty] WHERE [id_produktu] = @id_produktu" 
        InsertCommand="INSERT INTO [produkty] ([nazwa_produktu]) VALUES (@nazwa_produktu)" 
        SelectCommand="SELECT * FROM [produkty] ORDER BY [nazwa_produktu]" 
        UpdateCommand="UPDATE [produkty] SET [nazwa_produktu] = @nazwa_produktu WHERE [id_produktu] = @id_produktu">
        <DeleteParameters>
            <asp:Parameter Name="id_produktu" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="nazwa_produktu" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="nazwa_produktu" Type="String" />
            <asp:Parameter Name="id_produktu" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="JednostkiSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ksiazka_kucharskaConnectionString %>" 
        DeleteCommand="DELETE FROM [jednostki] WHERE [id_jednostki] = @id_jednostki" 
        InsertCommand="INSERT INTO [jednostki] ([nazwa_jednostki]) VALUES (@nazwa_jednostki)" 
        SelectCommand="SELECT * FROM [jednostki] ORDER BY [nazwa_jednostki]" 
        UpdateCommand="UPDATE [jednostki] SET [nazwa_jednostki] = @nazwa_jednostki WHERE [id_jednostki] = @id_jednostki">
        <DeleteParameters>
            <asp:Parameter Name="id_jednostki" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="nazwa_jednostki" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="nazwa_jednostki" Type="String" />
            <asp:Parameter Name="id_jednostki" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>


    <asp:SqlDataSource ID="KategorieSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ksiazka_kucharskaConnectionString %>" 
        DeleteCommand="DELETE FROM [kategorie] WHERE [id_kategorii] = @id_kategorii" 
        InsertCommand="INSERT INTO [kategorie] ([nazwa_kategorii]) VALUES (@nazwa_kategorii)" 
        SelectCommand="SELECT * FROM [kategorie] ORDER BY [nazwa_kategorii]" 
        UpdateCommand="UPDATE [kategorie] SET [nazwa_kategorii] = @nazwa_kategorii WHERE [id_kategorii] = @id_kategorii">
        <DeleteParameters>
            <asp:Parameter Name="id_kategorii" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="nazwa_kategorii" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="nazwa_kategorii" Type="String" />
            <asp:Parameter Name="id_kategorii" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="PoziomyTrudnosciSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ksiazka_kucharskaConnectionString %>" 
        DeleteCommand="DELETE FROM [poziomy_trudnosci] WHERE [id_poziomu_trudnosci] = @id_poziomu_trudnosci" 
        InsertCommand="INSERT INTO [poziomy_trudnosci] ([poziom_trudnosci]) VALUES (@poziom_trudnosci)" 
        SelectCommand="SELECT * FROM [poziomy_trudnosci] ORDER BY [poziom_trudnosci]" 
        UpdateCommand="UPDATE [poziomy_trudnosci] SET [poziom_trudnosci] = @poziom_trudnosci WHERE [id_poziomu_trudnosci] = @id_poziomu_trudnosci">
        <DeleteParameters>
            <asp:Parameter Name="id_poziomu_trudnosci" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="poziom_trudnosci" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="poziom_trudnosci" Type="String" />
            <asp:Parameter Name="id_poziomu_trudnosci" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

</asp:Content>
